<?php
/**
 * Single Product Thumbnails
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.3
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $post, $product, $woocommerce;

$attachment_ids = $product->get_gallery_attachment_ids(); ?>

<div class="thumbnails">

<?php if ( $attachment_ids ) {
	?>
	<ul class="product-single-thumbs clearfix"><?php

		$loop = 0;
		$columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 );

		foreach ( $attachment_ids as $id ) {

			$classes = array( 'zoom' );

			if ( $loop == 0 || $loop % $columns == 0 )
				$classes[] = 'first';

			if ( ( $loop + 1 ) % $columns == 0 )
				$classes[] = 'last';

			$attachment_url = wp_get_attachment_url( $id );

			if ( ! $attachment_url )
				continue;

			$src = wp_get_attachment_image_src( $id, 'shop-thumb' );
			
			echo '<li><a href="' . esc_attr( $attachment_url ) . '" title="' . esc_attr( get_the_title( $id ) ) . '" class="' . implode(' ', $classes) . '">
			<img src="' . $src[0] . '" alt="" />
			</a></li>';

			$loop++;
		}

	?></ul>
	<?php
} ?>

</div>